<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <title>查询并显示数据</title>
    <link rel="stylesheet" href="./css/bootstrap.css">
    <link rel="stylesheet" href="./css/font-awesome.css">
</head>

<body>
    <h1>用户列表</h1>
        <a href="./insert.html" class="btn btn-success"><i class="fa fa-plus-square fa-fw"></i>添加新用户</a>
        <?php
            require_once './conn.php';
            $result = mysqli_query($link,"select * from users");
            if(mysqli_num_rows($result)>0){
        ?>
                <table class='table-bordered'>
                    <thead>
                        <tr>
                            <th>序号</th>
                            <th>id</th>
                            <th>姓名</th>
                            <th>邮箱</th>
                            <th>电话号码</td>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                            $i=1;
                            while ($row=mysqli_fetch_array($result)){ 
                        ?>
                    <tr>
                        <td><?php echo $i ;?></td>
                        <td><?php echo $row['id']; ?></td>
                        <td><?php echo $row['name']; ?></td>
                        <td><?php echo $row['email'];   ?></td>
                        <td><?php echo $row['mobile'];  ?></td>

                        <td>
                            <a href="./update.php?id=<?php echo $row['id']; ?>" class="btn btn-info" > 修改</a> 
                            <a href=""class="btn btn-danger"> 删除</a> 
                        </td>
                    </tr>
                    <?php
                            $i++;
                            }
                    ?>
                    </tbody>
                    <?php
                        }
                        else {
                            echo "无数据";
                        }
                    ?>
                </table>

<body>
</html>